Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage integration test for requirements #152

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

TannazVhdBMWExt
Copy link
Contributor

No description provided.

@TannazVhdBMWExt TannazVhdBMWExt requested a review from a team as a code owner December 10, 2024 15:19
@phiwuu phiwuu added the internal Affects the CI, tests or refactorings only, not relevant to the end-user label Dec 10, 2024
@TannazVhdBMWExt TannazVhdBMWExt force-pushed the coverage-integration-test branch from 600c9e5 to fc04145 Compare December 12, 2024 14:26
@TannazVhdBMWExt TannazVhdBMWExt changed the title Coverage integration test for two requirements Coverage integration test for requirements Dec 12, 2024
@TannazVhdBMWExt TannazVhdBMWExt force-pushed the coverage-integration-test branch from 156fa3c to 46c3030 Compare December 12, 2024 14:57
four different coverage tests have been added
@TannazVhdBMWExt TannazVhdBMWExt force-pushed the coverage-integration-test branch from 9483724 to a7ac888 Compare December 13, 2024 14:10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments in above Makefile

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments in above Makefile

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments in above Makefile

THIS_TEST_ESCAPED:=$(subst /,\\/,$(THIS_TEST))
REFERENCE_OUTPUT:=report.reference_output

html_report.html: softreq.lobster sysreq.lobster lobster.conf trlc-softreq.conf trlc-sysreq.conf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this make target calls lobster-report, and hence no file called html_report.html will ever be generated.
Did you mean lobster.report instead?

Comment on lines +12 to +17
@if diff report.lobster $(REFERENCE_OUTPUT); then \
echo "Files are identical"; \
else \
echo "Files are different"; \
exit 1; \
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix the indentation

Comment on lines +10 to +17
html_report.html: softreq.lobster sysreq.lobster testreq.lobster lobster.conf trlc-softreq.conf trlc-sysreq.conf trlc-testreq.conf
@lobster-report
@if diff report.lobster $(REFERENCE_OUTPUT); then \
echo "Files are identical"; \
else \
echo "Files are different"; \
exit 1; \
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above:

  • no file called html_report.html will ever be generated; you probably meant report.lobster
  • please fix the indentation

text String
derived_from optional Software_Requirement [1 .. *]
just_up optional String
just_down optional String
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you introduce just_down? The tracing policy in lobster.conf shows that "Test Requirements" are on the lowest level. There is no level beneath them. just_down can never have any impact in this test setup. Or did you want to verify this fact?

text = '''Requirement3'''
derived_from = [softreq_coverage_half_example.requirement_d]
just_up = "needed"
just_down = "needed"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just_down will not have any impact in this test. It can be removed.

Comment on lines +10 to +17
html_report.html: softreq.lobster sysreq.lobster lobster.conf trlc-softreq.conf trlc-sysreq.conf
@lobster-report
@if diff report.lobster $(REFERENCE_OUTPUT); then \
echo "Files are identical"; \
else \
echo "Files are different"; \
exit 1; \
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above:

  • no file called html_report.html will ever be generated; you probably meant report.lobster
  • please fix the indentation

Comment on lines +10 to +17
html_report.html: softreq.lobster sysreq.lobster lobster.conf trlc-softreq.conf trlc-sysreq.conf
@lobster-report
@if diff report.lobster $(REFERENCE_OUTPUT); then \
echo "Files are identical"; \
else \
echo "Files are different"; \
exit 1; \
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above:

  • no file called html_report.html will ever be generated; you probably meant report.lobster
  • please fix the indentation

Comment on lines +12 to +17
@if diff report.lobster $(REFERENCE_OUTPUT); then \
echo "Files are identical"; \
else \
echo "Files are different"; \
exit 1; \
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@if diff report.lobster $(REFERENCE_OUTPUT); then \
echo "Files are identical"; \
else \
echo "Files are different"; \
exit 1; \
fi
@if diff report.lobster $(REFERENCE_OUTPUT); then echo '✅ Files are identical!'; else { echo '❌ ERROR: Files are different!'; exit 1; }; fi

Comment on lines +12 to +17
@if diff report.lobster $(REFERENCE_OUTPUT); then \
echo "Files are identical"; \
else \
echo "Files are different"; \
exit 1; \
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +12 to +17
@if diff report.lobster $(REFERENCE_OUTPUT); then \
echo "Files are identical"; \
else \
echo "Files are different"; \
exit 1; \
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +12 to +17
@if diff report.lobster $(REFERENCE_OUTPUT); then \
echo "Files are identical"; \
else \
echo "Files are different"; \
exit 1; \
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,12 @@
package coverage_example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package names in the rsl files are same and it shows the following error message

duplicate definition, previous definition at tests-integration/projects/coverage-half/example.rsl:1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for clarification: it is okay to have duplicates across different test cases. But if you use the TRLC extension for VSCode, and if it scans the whole repository, then it will complain about duplicated definitions.

@@ -0,0 +1,12 @@
package coverage_example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requirements "Software Requirements"
{
source: "softreq.lobster";
requires: "Test Requirements";
Copy link
Member

@phiwuu phiwuu Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add the requires keyword here? Since "Test Requirements" already use trace to: "Software Requirements"; it will not impact the tool behavior. Or was the idea to test exactly that the statement has no impact?

After investigation it seems that lobster-report behaves like follows (but should not):

  • if requires is specified for a level (here: "Software Requirements"), then any implicit conditions imposed through trace to coming from other levels are ignored.
  • That's why the coverage is 100%, where it should really be 0%.

Recommendation:
The integration tests shall focus on the trace to feature only. Please remove requires from the tests. The behavior of requires will be replaced by a new feature called trace from with pull request #91 anyway.

{
text = '''Requirement3'''
derived_from = [softreq_coverage_half_example.requirement_d]
just_up = "needed"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you give a justification in this test, while adding a link to requirement_d at the same time?

"status": null
}
],
"coverage": 100.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requirement_d is not linked to any requirement from level "System Requirements", but the tracing policy enforces that through trace to. As stated above, the requires keyword apparently removes this strict condition, which is a bug. Please do not use requires in the tests, and set the expected coverage to 0 here.

@@ -0,0 +1,22 @@
package coverage_half_example
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test case is called coverage-mix, not coverage_half_example. It is very confusing to give the TRLC package the name of a different test case.


requirements "System Requirements" {
source: "sysreq.lobster";
trace to: "Software Requirements";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is very confusing to derive system requirements from software requirements. Please consider to either switch the names, or use made-up names like "Apple", "Banana", etc. instead!

type Software_Requirement
{
text String
derived_from optional System_Requirement [1 .. *]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one requirement in softreq_example.trlc does not use the attribute derived_from at all. It can be removed.
Furthermore, the example.rsl demands that the breakdown happens the other way around, from software requirements to system requirements.
Please keep the test as simple as possible, and don't pollute it with configuration aspects that are not important to the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Affects the CI, tests or refactorings only, not relevant to the end-user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants